<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>给某个⽇期增加 N 天并输出</title>
</head>
<body>
    
</body>
</html>
<script>
    function res(arr,obj) {
    var temp=new Date(arr.replace(/-/g,"/"));   //把日期字符串转换成日期格式
    var item=new Date((temp/1000+(86400*obj))*1000);    //增加n天后的日期
    var count=item.getFullYear()+"-"+(item.getMonth()+1)+"-"+(item.getDate());  //将日期转化为字符串格式
    return count;
}
console.log(res('2022-10-14',5));
</script>